#include<bits/stdc++.h>

using namespace std;
int oppo[114514];
int vis[114514];
int n;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>oppo[i];
        vis[i]=0;
    }
    int sum=n;
    int minn=1e18;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(oppo[i]>oppo[j]&&vis[j]!=1&&vis[i]!=2)
            {
                sum--;
                vis[j]=1;
                vis[i]=2;
            }
            if(vis[i]>vis[j]&&vis[i]==2&&vis[j]==1)
            break;
        }
        minn=min(minn,sum);
    }
    cout<<minn;
    return 0;
}

